package com.agricultural.machine.decorator;

import com.agricultural.machine.common.IMachine;

/**
 * 农机装饰器工厂类 - 装饰器模式
 */
public class MachineDecoratorFactory {
    /**
     * 创建带日志记录功能的农机
     */
    public static IMachine createLoggedMachine(IMachine machine) {
        return new LoggingMachineDecorator(machine);
    }
    
    /**
     * 创建带性能监控功能的农机
     */
    public static IMachine createPerformanceMonitoredMachine(IMachine machine) {
        return new PerformanceMonitorDecorator(machine);
    }
    
    /**
     * 创建带全部功能的农机（组合多个装饰器）
     */
    public static IMachine createFullyDecoratedMachine(IMachine machine) {
        // 先添加性能监控，再添加日志记录
        IMachine performanceMonitored = createPerformanceMonitoredMachine(machine);
        return createLoggedMachine(performanceMonitored);
    }
}










